package cn.tedu.mybatis.mapper;

import cn.tedu.mybatis.pojo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BlogMapper {
    //@Insert("INSERT INTO blog(content,created,user_id)\n" +
    //      "        VALUES(#{content},#{created},#{userId})")
    int insert(Blog blog);
    //@Delete("DELETE FROM blog\n" +
    //       "        WHERE id=#{id}")
    int deleteById(Integer id);
    //@Update("UPDATE blog SET content=#{content},created=#{created},user_id=#{userId} WHERE id=#{id}")
    int update(Blog blog);
    //@Select("SELECT id,content,created,user_id userId FROM blog WHERE id=#{id}")
    Blog selectById(Integer id);
    //@Select("SELECT id,content,created,user_id userId FROM blog")
    List<Blog> selectAll();
    //@Select("SELECT content,created FROM blog WHERE id=#{id}")
    /**
     * 将来针对某些业务展示部分微博信息
     */
    BlogVO1 selectBlogVO1(Integer id);
    //@Select("SELECT content,user_id userId FROM blog")
    List<BlogVO2> selectBlogVO2All();

    int dynamicUpdateBlogById(Blog blog);
    int dynamicDeleteBlogById(Integer[] ids);
    int dynamicDeleteBlogById2(List<Integer> ids);

    BlogVO3 selectResultMap(Integer id);
    //通过博客id查询该博客下的所有评论
    BlogVO4 selectBlogAndComment(Integer id);
    int countBlog();
}